const fs = require("fs")

//创建写入流
let ws = fs.createWriteStream("text3.txt");

ws.once("open", () => {
    console.log("通道打开！");
    ws.write("今天天气真好1！");
    ws.write("今天天气真好2！");
    ws.write("今天天气真好3！");
    ws.write("今天天气真好4！");
    ws.write("今天天气真好5！");
    //写入结束
    ws.end();
})

//关闭通道
ws.once('close', () => {
    console.log("通到已关闭")
})